Functions > di_open

Syntax 

The di_open function opens the device for communication. This function has to be called before any of the other functions can be called.

Syntax 

int di_open(devno);

unsigned devno;

/* device ID */

Parameters

devno

devno is different for each instrument.

DI-145, DI-154, DI-194, DI-195B, DI-148, DI-149, DI-158, DI-245, and DI-71x-U
DI-1100, DI-1110, DI-1120, DI-2008, DI-2108, DI-2108-P, DI-4108, DI-4208, and DI-4718B devices
DI-500, DI-510, DI-720, DI-730, and DI-5001 USB devices
DI-71x, DI-720, DI-730, DI-78x, DI-5001 Ethernet devices
ALL Printer Port devices
DI-4xx
DI-700

Return Value

DI_NO_ERR No error
DI_ALREADY_OPEN_ERR Device is already open
DI_RESET_ERR Invalid parallel port number or serial device did not echo stop command
DI_INFO_ERR Cannot obtain parallel port address or invalid IP address format
DI_CLOSE_ERR Parallel port is in use by another process
DI_DRIVER_ERR Device driver not found
DI_COMM_ERR Communication error

Dependencies

none

Remarks

See Device IDs and Drivers for a list of DATAQ Instruments, Inc. Device IDs and drivers under different Windows™ Operating Systems.

Sample Code

#include "200sdk.h"

int errcode;

char errstr[255];

main()

{

if(errcode = di_open(0xFFFD3A04)){

/* open a DI-158 installed at COM4 with a Baud rate of 460800 */

di_strerr(errcode,errstr);

printf("%s",errstr);

}

else

printf("Device installed successfully.....\n");

di_close();

}

 

Copyright © DATAQ Instruments, Inc.